﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Model.Sys_Controllers>>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"> 

    <title>
        <%:ViewData["Title"]%></title>
    <script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-ui.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-ui-i18n.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.layout.1.2.0.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.layout.1.2.0.min.setting.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.dataTables.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
    <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="/scripts/jqueryuploadify/swfobject.js" type="text/javascript"></script>
    <script src="/scripts/jqueryuploadify/jquery.uploadify.v2.1.0.min.js" type="text/javascript"></script>
    <script src="/Scripts/JqueryUploadify/jquery.uploadify.v2.1.0.min-setting.js" type="text/javascript"></script>
    <link href="/Content/layout-default-latest.css" rel="stylesheet" type="text/css" />
    <link href="/Content/page.css" rel="stylesheet" type="text/css" />
    <link href="/scripts/JqueryUploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <link href="<%:"/Content/themes/"+ViewBag.User.Sys_Theme.Url%>/jquery-ui.css" rel="stylesheet"
        media="screen" type="text/css" />
    <link href="/Content/Site.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function addOrderRow(tab, rowNum, colNum, obj, addType) {
            var detailbody = document.getElementById(tab);
            var row = document.createElement("tr");
            var newrow = obj.parentNode.parentNode.innerHTML;
            if (addType == 'add') {
                var row = detailbody.insertRow(-1);
                for (var i = 0; i < obj.parentNode.parentNode.childNodes.length; i++) {
                    var cell = row.insertCell(-1);
                    cell.innerHTML = obj.parentNode.parentNode.childNodes[i].innerHTML;
                    //如果表单中有值就清空 
                    for (var k = 0; k < cell.childNodes.length; k++) {
                        if (cell.childNodes[k].type == 'text') 
                        {
                            cell.childNodes[k].value = '';
                            if (i==4)
                                cell.childNodes[k].value = '100';
                        }
                        if (cell.childNodes[k].type == 'textarea') { cell.childNodes[k].value = ''; }
                        if (cell.childNodes[k].type == 'checkbox') { cell.childNodes[k].checked = false; }
                        if (cell.childNodes[k].type == 'radio') { cell.childNodes[k].checked = false; }
                        if (cell.childNodes[k].type == 'select-multiple') { cell.childNodes[k].selectedIndex = -1; }
                        if (cell.childNodes[k].type == 'select-one') { cell.childNodes[k].selectedIndex = 0; }
                    }
                    //cell.innerHTML=arr[i]; 
                }

            } else if (addType == 'copy') {
                //copy 
                //detailbody.insertRow().insertCell().innerHTML = newrow;   ok 
                var row = detailbody.insertRow();
                for (var i = 0; i < obj.parentNode.parentNode.childNodes.length; i++) {
                    var cell = row.insertCell(-1);
                    cell.innerHTML = obj.parentNode.parentNode.childNodes[i].innerHTML;
                }
            } else {
                //delete 
                if (confirm("确定要删除吗？")) {
                    obj.parentNode.parentNode.parentNode.removeChild(obj.parentNode.parentNode);
                } else {
                    return false;
                }
            }
            //只显示最后一个add按钮 
            var leg = detailbody.childNodes.length;
            if (leg > 1) {
                for (var j = 0; j < leg - 2; j++) {
                    document.getElementsByName("btnAdd")[j].style.visibility = "visible";
                }
                document.getElementsByName("btnAdd")[leg - 2].style.visibility = "visible";
                document.getElementsByName("btnDelete")[0].style.visibility = "visible"; 
            }
            //显示除第一个外所有delete按钮 
            if (leg > 1) {
                for (var j = 1; j < leg - 1; j++) {
                    document.getElementsByName("btnDelete")[j].style.visibility = "visible";
                }
            }
        } 
    </script>
</head>
<body>
    <div id="errormsg">
    </div>
     <div id="msg" title="您有新消息">
    </div>
    <div class="ui-layout-center ui-widget-content" id="Main">
        <%Html.RenderAction("Desktop"); %>
    </div>
    <div class="ui-layout-north  ui-widget-header">
        <div style="float: left;">
            <div style="font-size: 160%;">
                <%:ViewData["Title"]%></div>
            <div style="font-size: 110%;">
                <%: ViewData["Title1"]%></div>
        </div>
        <div style="float: right; margin: 10px;">
            <span id="Loading" class="ui-state-error">&nbsp; Loading... &nbsp;</span> <span id="datetimenow"
                style="cursor: pointer;"></span>&nbsp; 当前用户：<%:ViewBag.User.UserName %>
            (<%:ViewBag.User.Sys_Enterprise.EnterpriseName%>) |
            <%=Ajax.ActionLink("桌面", "Desktop", new AjaxOptions() {  UpdateTargetId = "Main" })%>
            |
            <%=Ajax.ActionLink("功能", "Map", new AjaxOptions() {  UpdateTargetId = "Main" })%>
             |
            <%=Ajax.ActionLink("通知", "Notification", new AjaxOptions() { UpdateTargetId = "Main" })%>
            |
            <%=Ajax.ActionLink("主题", "Theme", new AjaxOptions() {  UpdateTargetId = "Main" })%>
            |
            <%=Ajax.ActionLink("密码", "Password", new AjaxOptions() {  UpdateTargetId = "Main"})%>
            |
            <%=Ajax.ActionLink("帮助", "Help", new AjaxOptions() {  UpdateTargetId = "Main" })%>
            |
            <%=Html.ActionLink("退出系统", "LogOff", "Account", new { area = "" },null)%>
        </div>
    </div>
    <div class="ui-layout-west  ui-widget-content">
        <div id="Menu_accordion">
            <div>
                <%foreach (var item in Model)
                  {
                      if (item.SystemCode.Length == 3)
                      {
                          //判断一下 下级是否有内容
                          if (Model.Any(a => a.SystemCode.StartsWith(item.SystemCode) && a.SystemCode != item.SystemCode))
                          {
                              Response.Write("</div>");
                              Response.Write("<h4><a>" + item.DisplayName + "</a></h4>");
                              Response.Write("<div>");
                          }
                      }
                      else
                      {
                          if (Model.Any(a => a.SystemCode.StartsWith(item.SystemCode) && a.SystemCode != item.SystemCode))
                          {
                              Response.Write("<a>" + ("└").PadLeft((item.SystemCode.Length - 3) / 3, '　') + " " + item.DisplayName + "</a>");
                          }
                          else
                          {
                              Response.Write(Ajax.ActionLink(("└").PadLeft((item.SystemCode.Length - 3) / 3, '　') + " " + item.DisplayName, "Index", item.ControllerName, null, new AjaxOptions() { UpdateTargetId = "Main" }, new { style = "display:block;  padding:5px 0;" }));
                          }
                      } %>
                <%} %>
            </div>
        </div>
    </div>
    <div class="ui-layout-south  ui-widget toolbar ui-widget-content ui-state-default">
        © 2007-<%:DateTime.Now.Year %>
        <a href="http://www.ebyshow.net" target="_blank">Ebyshow</a>
    </div>
</body>
</html>
